package com.mikey.unsafe;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author :Mikey
 * @description :
 * @create :2022-09-20 16:18:00
 */
public class UnsafeMap {
    public static void main(String[] args) {
       // Map<String , String> map = new HashMap<>();
        Map<String , String> map = new ConcurrentHashMap<>();
        //默认加载因子=0.75，初始化容量=16
        /**
         * 1,Collections.
         * 2,
         */
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                map.put(Thread.currentThread().getName(), UUID.randomUUID().toString().substring(1, 5));
                System.out.println(map);
            },String.valueOf(i)).start();
        }
    }
}
